$(function () {
    checkToken();
    function checkToken() {
        var systoken = sessionStorage.getItem('systoken');
        if (!systoken) {
            layer.msg("请先登录!")
            location.href = "login.html"
        }
    }

    layui.config({
        base: './static/js/',
        version: '101100'
    }).use('admin');
    layui.use(['jquery', 'admin'], function () {
        var $ = layui.jquery;
    });
    $("#loginOut").click(function () {
        var systoken = sessionStorage.getItem('systoken');
        var stamp = new Date().getTime();
        var version = "0";
        var visit_plat = "0";
        var visit_type = "0";
        var is_used = "0";
        var param = {
            stamp: stamp,
            version: version,
            visit_plat: visit_plat,
            visit_type: visit_type,
            is_used: is_used
        };
        var param = JSON.stringify(param);
        var url = path + "/teacher/loginOut";
        $.ajax({
            type: "post",
            url: url,
            dataType: "json",
            data: {param: param},
            headers: {Authorization: systoken},
            success: function (data) {
                sessionStorage.clear();
                window.location.href = 'login.html'
            },
            error: function (data) {
                sessionStorage.clear();
                window.location.href = 'login.html';
            }
        });
    })
})